<%-- 
    Document   : Employee
    Created on : May 9, 2012, 9:28:43 AM
    Author     : Thanh Luan
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j" %>

<html>
    <head>

        <link rel="stylesheet" type="text/css" href="../css/paging.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/confirm.js"></script>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery.fancybox-1.3.4.pack.js"></script>
        <link rel="stylesheet" type="text/css" href="../scripts/tabs/slidingtabs-horizontal.css">
        <script type="text/javascript" src="../scripts/tabs/slidetab.js"></script>
        <!-- -->
        <link rel="stylesheet" type="text/css" href="../css/thickbox.css"/>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/thickbox.js"></script>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/jquery.rateit.js"></script>
        <script type="text/javascript" language="javascript" src="../scripts/jQuery/easypaginate.js"></script>
        <link rel="stylesheet" type="text/css" href="../css/rateit.css">


        <script type="text/javascript" language="javascript">
            var abc  =false;
            var open_cur = 0;
            $j = jQuery.noConflict();
            $j(document).ready(function(){
                initThickBox('.thickbox');
          
                $j('.st_horizontal').slideTabs();
               
                Tab4Kapi();
                //searchClient();
                $j('.text_search').live('keyup',function(){
                    if($j('.text_search').val() == ""){
                        $j('.noteRow').show();
                        $j('.close').trigger('click');   
                                   
                    }else{
                        $j('.close').trigger('click');   
                        $j('.noteRow').hide();
                        $j('.noteRow').each(function(){
                            html = $j(this).html();                            
                            if(ununicode(html).indexOf(ununicode($j('.text_search').val())) > -1)  {                                
                                $j(this).show();
                            }else{
                                $j(this).hide();
                            }
                        });
                    }

                });
                $j('.search_box').hide();       
                $j('.sidebar_search').live('click',function(){
                    $j('.search_box').hide();
                    if($j(this).next().hasClass('active')){

                        $j('.search_box').removeClass('active');
                    }else{

                        $j('.search_box').removeClass('active');
                        $j(this).next().addClass('active');
                        $j(this).next().show();
                    }
                });
                $j(".content_right").live("click",function(){
                    $j('.search_box').hide();
                });

                $j('.fancyLinks').fancybox({               
                    closeBtn:false, 
                    helpers : {
                        overlay : {
                            closeClick : false,
                            css : {
                                'cursor':'default'
                            }
                        }
                    }
                });

                $j(".department1").live("click",function(){ 
                    
                    
                    
                    fn450 = $j(this).attr("lang");
                    $j.post("N450_N850.jsp?&action=group&fh200=99&fn450="+fn450 +"&fn850=0",function(data){
                        if(data!=null){ 
                            window.location.href="employeenew.jsp?&action=reload&department1&fh200=99&fn450="+fn450 +"&fn850=0";
                        }
                           
                    });  
                });
                $j(".department2").live("click",function(){
                   
                    fn850 = $j(this).attr("lang");
                    fn450 = $j(".department1").attr("lang");
                   
                    window.location.href="employeenew.jsp?actionn=reload&fn450="+0 +"&fn850="+fn850;
                    
                });
                
                $j(".department3").live("click",function(){
                     
                    
                    fn850 = $j(this).attr("lang");
                    fn450 = $j(".department1").attr("lang");
                  
                    window.location.href="employeenew.jsp?actionn=reload&fn450="+0 +"&fn850="+fn850;
                   
                });
                
                // Begin Event load ajax form CRM
                   
                $j('.contactN950').live('click',function(){
                    object = $j(this).next();                                              
                    var pn100KH = $j('#form-input-customer\\:pn100').val();                     
                       
                       
                    $j.post("contactCRM.jsp?action=editajaxpage&pn100="+ pn100KH+"&table=N100", function(data){
                        $j('.customer-boxcontact').html(data);
                    });
                         
                        
                    
                });
                $j('.acountT025').live('click',function(){
                    object = $j(this).next();
                    var pn100KH = $j('#form-input-customer\\:pn100').val();      
                    $j.post("accountCRM.jsp?action=editajaxpage&pn100="+pn100KH+"&tv026=N100",function(data){
                        $j('.customer-boxacount').html(data);
                    }) ;
                    
                });
                $j('.infoL200').live('click',function(){
                    object = $j(this).next();
                    var pn100KH = $j('#form-input-customer\\:pn100').val();
                    
                    $j.post("l200EMP.jsp?action=editajaxpage&pn100="+pn100KH,function(data){
                        $j('.customer-boxL200').html(data);
                    }) ;
                    
                });
                
                   
                $j('.infoN350').live('click',function(){
                    object = $j(this).next();
                    var pn100KH = $j('#form-input-customer\\:pn100').val();   
                    $j.post("passportCRM.jsp?action=editajaxpage&pn100="+ pn100KH, function(data){
                        $j('.customer-boxN350').html(data);
                    });
                    
                });
                    
                    
                // End Event load ajax form CRM for Dashbord
                //save column N900
                $j(".updateN900").live("click",function(){
                    pn100 = $j(this).parent(".group_list_cus").attr('lang');
                    fn850 = $j(this).attr('lang');
                    nv902 = $j(this).text();
                    showPleaseWait();
                    $j(this).parents().parents().parents().parents().parents().parent('.item').find('.nv852').text(nv902);
                    
                    $j.post('n900Begin.jsp?action=updateColumN900&pn100='+pn100+'&fn850='+fn850+'&nv902='+nv902,function(data){
                        if(data != null){
                            hidePleaseWait();
                        }
                    });
                    
                });


                $j('.webcame').live('click',function(e){
                    
                    pn100  =$j(this).attr('lang');
                    $j('.scapture').css('visibility','visible');
                    $j('.scapture').css('margin-top',e.pageY-400);
                    $j('.scapture').css('margin-left',e.pageX-630);
                    $j.post('webcame.jsp?pn100='+pn100,function(data){
                        $j('.scapture').html(data);
                    });
                });
                $j( ".sendSMS_person" ).click(function() {
                    $j( "#togglesms" ).show();
                    $j( "#togglesms" ).animate({height:'auto',opacity:'0.9'},"slow");
                    $j( "#togglesms" ).animate({width:'39%',opacity:'0.9'},"slow");
                    var info = $j(this).attr('lang');
                    $j.post("SgtSMS.jsp?"+info,function(data){
                        if(data!=null){
                            $j( "#togglesms" ).html(data);
                        }
                    });
                });
                $j('.check_select').live('click',function(){
                    //    $j(".abc").trigger("click");
                    $j( "#toggle" ).hide();
                    var lang= $j(this).attr("lang");
                    var boool;
                    if( $j(this).is(":checked"))
                    {
                        boool = true;
                    }
                    else
                    {
                        boool = false;
                    }
                            
                    $j.post("employeenew.jsp?action=addCusp100&p100="+lang+"&valueC="+boool,function(data){
                            
                    });
                });
                    
                $j(".checkAll").live("click",function(){                  
                    flag = $j('.checkAll').is(':checked');                
                    $j(".check_select").each(function(){
                        $j('.check_select')  .attr('checked', flag);
                    });                 
                    var boool;
                    if( $j(this).is(":checked"))
                    {
                        boool = true;
                    }
                    else
                    {
                        boool = false;
                    }                  
                    $j.post("employeenew.jsp?action=addAllCusp100&boool="+boool,function(data){                          
                    });

                });
                $j('.itemcontent').live('click',function(){
                    showPleaseWait();
                    pn100 = $j(this).attr('lang'); 
                   
                    $j('.noteContent').slideUp();
                    $j('.noteContent').html(''); 
                    var debt = $j(this).parent().parent().next(); 
                    if(debt.hasClass('active')){
                        debt.removeClass('active');
                    }else{                                               
                        debt.removeClass('active');
                        debt.addClass('active');                                               
                        $j.post('itemEmployeenew.jsp?action=getitemvaluePn100&pn100='+pn100,function(data){                      
                            if(data !=null){
                                hidePleaseWait();
                                debt.html(data);
                                debt.slideDown();
                            }
                        });                    
                    }
                });
                slide = gup( 'tab' );
                if(slide != null && slide !=undefined && slide.length > 0){
                    $j('.'+slide).trigger('click') ;
                }
                
                $j('.find_all_emp').live('click',function(){
                    showPleaseWait();
                    keyserch=$j(this).parent().prev().prev().val();
                  
                    hidePleaseWait();
                    window.location="employeenew.jsp?action=functionSearch&keysearch="+keyserch+"&typesearch=0&pagename=ALL";
                    hidePleaseWait();
                  
                });
               
            });
        </script>

    </head>


    <body>
        <div id="togglesms">

        </div>
        <a4j:form>
            <f:loadBundle basename="#{environmentSession.localizationSource}" var="locale"/>
            <h:outputText value="<div class='permission' lang='#{loginSession.right.MENU_EMP_VIEW}'></div>" escape="false"/>

            <div id="content">
                <div id="menutop_top">
                    <div class="div_search_menutop">
                        <div class="item_search">

                            <h:inputText onfocus="if(this.value=='search') this.value='';" style="float:left;" styleClass="text_search" value="#{EmpBean.keySearch}"/>
                            <div style="float:left;border-top: 1px solid #55ACDB;border-bottom: 1px solid #55ACDB;" class="img_search"> <h:graphicImage style="float:left;" value="../images1/arrow_down.png"/></div>
                            <div style="float:left;border: 1px solid #55ACDB;"> <h:graphicImage styleClass="find_all_emp" style="float:left;" value="../images1/btn_search.png"/></div>
                        </div>
                        <div class="form_search_header">
                            <div class="item_search "><h:outputText value="x" styleClass="close_search" style="font-weight:bold;float:right;margin-right:2.2%;"/></div>
                            <div class="item_search">
                                <table id="table_search">
                                    <tr>
                                        <td class="celltable">
                                            <h:selectOneRadio styleClass="css_radio" value="#{EmpBean.typeSearch}">
                                                <f:selectItem itemValue="2" itemLabel="Họ tên" />

                                                <f:selectItem itemValue="1" itemLabel="Phone" />
                                                <f:selectItem itemValue="3" itemLabel="CMND" />
                                                <f:selectItem itemValue="5" itemLabel="MSNV" />
                                                <f:selectItem itemValue="4" itemLabel="Email" />

                                            </h:selectOneRadio>
                                        </td>

                                    </tr>
                                    <tr>
                                        <td class="celltable">
                                            <h:commandButton action="#{EmpBean.reload}" value="#{locale.search}" styleClass="buttonsearch">
                                            </h:commandButton>
                                        </td>

                                    </tr>
                                </table>

                            </div>
                        </div>
                    </div>

                    <div class="icon_action">
                        <h:outputLink  rendered="#{loginSession.right.EMP_LST_CRE}" value="editfromemployee.jsp?action=addEmp&height=282px&width=345px" styleClass="fancybox" id="fancybox">
                            <h:graphicImage title="#{locale.addEmployee}" value="../images1/add_per.png"/>

                        </h:outputLink>

                    </div>

                    <div class="icon_action">
                        <div class="classimageSMS">
                            <img src="../images1/sms.png" class="sendSMS_person" lang="page=sendSMSitemEmployee" title="Xác nhận  SMS"/>
                        </div>

                    </div>
                    <div class="icon_action">
                        <h:outputLink rendered="#{loginSession.right.EMP_LST_DLE}" value="employeeDelete.jsp">
                            <img src="../images1/del_emp.png" title="Danh sách nhiên viên đã nghỉ"/>
                        </h:outputLink>
                    </div>

                    <div class="icon_action">
                        <h:commandButton rendered="#{loginSession.right.EMP_LST_EXC}" style="margin-left:0px;" actionListener="#{EmpBean.exportExcel()}"  
                                         onclick="showPleaseWait();"                                   
                                         styleClass="buttonExcel" >                

                        </h:commandButton>

                    </div>

                    <div class="icon_action">
                        <h:outputLink  rendered="#{loginSession.right.EMP_LST_MAL}" value="popUpSendEmail.jsp?page=employee&step=9&fk100reload=0&KeepThis=true&amp;TB_iframe=true&amp;height=653&amp;width=741&amp;modal=true" styleClass="thickbox add_new abc" id="thickbox15"  >
                            <img src="../images1/email.png" title="Send mail"/>
                        </h:outputLink>

                    </div>

                </div>
                <div id="menutop">
                    <div class="dropdown">
                        <div class="select_choise">
                            <a href="#"><span>Khu vực</span></a>
                        </div>
                        <div class="select_hidden">
                            <ul>

                                <li><a href="#"><span>Filter Cấp 3</span></a></li>
                                <li><a href="#"><span>Filter Cấp 3</span></a></li>
                            </ul>
                        </div>
                    </div>
                    <h:panelGroup rendered="#{loginSession.right.DAB_LST_PAR}">
                        <div class="dropdown">
                            <div class="select_choise">
                                <a href="#">
                                    <span class="department2" lang="<h:outputText value="#{n450_n850.fn850}"/>">
                                        <h:outputText rendered="#{n450_n850.fn850 !=0}" value="#{n450_n850.nv851}"/>
                                        <h:outputText rendered="#{n450_n850.fn850 ==0}" value="Tất cả"/>
                                    </span>
                                </a>

                            </div>
                            <div class="select_hidden departmentlistN850">

                                <ul>
                                    <li><a href="#"><span class="department3" lang="<h:outputText value="0"/>">
                                                <h:outputText value="Tất cả"/>
                                            </span></a></li>                          


                                    <a4j:repeat value="#{n450_n850.listComb850}" var="item">
                                        <li><a href="#"><span class="department2" lang="<h:outputText value="#{item.value}"/>">
                                                    <h:outputText value="#{item.label}"/>
                                                </span></a></li> 
                                            </a4j:repeat>
                                </ul>
                            </div>
                        </div>
                    </h:panelGroup>

                </div>

                <%--    <div class="fillter">
                        <div class="dropdown">
                            <h:panelGroup id="reload5">
                                <h:panelGroup  rendered="#{EmpBean.fk400 > 0}" >
                                    <div class="select_choise ">

                                        <a href="#"><span><h:outputText value="Action"/></span></a>


                                    </div>
                                    <div class="select_hidden">
                                        <ul>

                                            <li>
                                                <h:outputLink rendered="#{EmpBean.fk400 > 0}" value="addgroupcustomer.jsp?action=loadGroup&page=employeenew.jsp&pk400=#{EmpBean.fk400}&kv451=N100E&KeepThis=true&amp;TB_iframe=true&amp;height=453&amp;width=941&amp;modal=true" styleClass="thickbox add_new" id="thickbox2"  >
                                                    <span> <h:outputText value="#{locale.add_group}"/></span>
                                                </h:outputLink>
                                            </li>
                                            <li >
                                                <h:outputLink rendered="#{EmpBean.fk400 > 0}" value="removegroupcustomer.jsp?action=loadGroup&page=employeenew.jsp&pk400=#{EmpBean.fk400}&kv451=N100E&KeepThis=true&amp;TB_iframe=true&amp;height=425&amp;width=952&amp;modal=true" styleClass="thickbox add_new" id="thickbox3"  >
                                                    <span> <h:outputText value="#{locale.delete_group}"/></span>
                                                </h:outputLink>

                                            </li>


                                        </ul>
                                    </div>
                                </h:panelGroup>
                            </h:panelGroup>
                        </div>
                    </div> --%>

                <div style="width: 100%;float: left;height: 67%;overflow: auto;">
                    <div class="headerdivtable">
                        <div class="itemheaderdivtable_center" style="width: 2%;">
                            <h:outputText value="STT"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 10%;">
                            <h:outputText value="ACTION"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 1%;">
                            <h:selectBooleanCheckbox styleClass="checkAll" value=""/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 15%;">
                            <h:outputText value="HỌ TÊN" />
                        </div>
                        <%--  <div class="itemheaderdivtable_center" style="width: 6%;">
                              <h:outputText value="XÉT DUYỆT"/>
                          </div> --%>
                        <div class="itemheaderdivtable_center" style="width: 6%;">
                            <h:outputText value="CHỨC VỤ"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 6%;">
                            <h:outputText value="GIỚI TÍNH"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 8%;">
                            <h:outputText value="PHÒNG BAN"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 10%;">
                            <h:outputText value="PHONE"/>
                        </div>

                        <div class="itemheaderdivtable_center" style="width: 12%;">
                            <h:outputText value="EMAIL" />
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 8%;">
                            <h:outputText value="NGÀY SINH"/>
                        </div>
                        <div class="itemheaderdivtable_center" style="width: 18%;">
                            <h:outputText value="NGÀY LÀM VIỆC"/>
                        </div>



                    </div>

                    <div class="headerdivtable_over">
                        <a4j:repeat  value="#{EmpBean.allListN100}" var="item" rowKeyVar="index" >

                            <div class="noteRow headerdivtable_bootom <h:outputText rendered="#{index%2 !=0}"  value="headerdivtable_tr"/>">
                                <div class="itemheaderdivtable_center " style="width: 2%;color:#0055A6;">
                                    <h:outputText value="#{index+1}"/>
                                </div>
                                <div class="itemheaderdivtable_center" style="width: 10%;">
                                    <h:outputLink   rendered="#{loginSession.right.EMP_LST_UCV}"  value="editdivisionEm.jsp?action=updatechucvu&pn100N250=#{item.pn100}&height=320px&width=500px" styleClass="fancybox">
                                        <img src="../images/updatedivision.png" alt="edit" title="edit"/>
                                    </h:outputLink>
                                    <h:outputLink   rendered="#{loginSession.right.EMP_LST_ETC}"  value="convertEmptoCus.jsp?id=#{item.pn100}&flag=N100Delete&width=300&height=150" styleClass="fancybox">
                                        <img src="../images/convert.gif" alt="" title="Xóa nhân viên"/>
                                    </h:outputLink>
                                    <h:outputLink   rendered="#{loginSession.right.EMP_LST_CHD}"  value="contract.jsp?action=employeeHD&pn100=#{item.pn100}">
                                        <img src="../images/laodong.png" alt="edit" title="Hợp đồng"/>
                                    </h:outputLink>
                                    <h:outputLink   rendered="#{loginSession.right.EMP_LST_MOD}"  value="editfromemployee.jsp?action=editEmp&pn100A=#{item.pn100}&height=320px&width=500px" styleClass="fancybox">
                                        <img src="../images/edit.png" alt="edit" title="edit"/>
                                    </h:outputLink>


                                    <h:outputLink   rendered="#{loginSession.right.EMP_LST_DEL}"  value="delete.jsp?id=#{item.pn100}&flag=N100&width=300&height=150" styleClass="fancybox">
                                        <img src="../images/delete_1.png" alt="delete"  title="delete" />
                                    </h:outputLink>
                                </div>
                                <div class="itemheaderdivtable_center" style="width: 1%;">
                                    <h:selectBooleanCheckbox styleClass="check_select" lang="#{item.pn100}" style="margin-top:5px;"  value=""/>
                                </div>
                                <div class="itemheaderdivtable_left graphic" style="width: 15%;">
                                    <h:outputText style="margin-left:3px;" styleClass="itemcontent itemcontent#{item.pn100}" value="#{item.hoten}" lang="#{item.pn100}"></h:outputText>



                                    </div>

                                    <div class="itemheaderdivtable_center" style="width: 6%;">
                                    <h:outputText value="#{item.nv251}" styleClass="nv852 "/>
                                </div>
                                <div class="itemheaderdivtable_center" style="width: 6%;">
                                    <h:outputText rendered="#{item.nv115=='F'}" value="Nữ"/><h:outputText rendered="#{item.nv115=='M'}" value="Nam"/>
                                </div>
                                <div class="itemheaderdivtable_center" style="width: 8%;">
                                    <h:outputText value="#{item.nv852}" styleClass="nv852 "/>
                                </div>
                                <div class="itemheaderdivtable_left " style="width: 10%;">
                                    <h:outputText value="#{item.nv121}" styleClass="sendSMS_person" lang="page=sendSMSitemEmployee&group=1&hoten=#{item.hoten}&phone=#{item.nv121}&fn100=#{item.pn100}"/>
                                </div>
                                <div class="itemheaderdivtable_left " style="width: 12%;">
                                    <h:outputLink value="popupSendMailPerson.jsp?page=employee&idx=#{item.pn100}&mailx=#{item.nv105}&typex=employee&KeepThis=true&amp;TB_iframe=true&amp;height=653&amp;width=741&amp;modal=true" styleClass="thickbox add_new" id="thickbox3"  ><h:outputText value="#{item.nv105}" /></h:outputLink>
                                    </div>

                                    <div class="itemheaderdivtable_center " style="width: 8%;">
                                    <h:outputText value="#{item.nd128}" ><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText>
                                    </div>
                                    <div  class="itemheaderdivtable_left " style="width: 18%;">
                                    <h:outputText value="#{item.ld201}" ><f:convertDateTime pattern="dd/MM/yyyy"/></h:outputText> 
                                    </div>



                                </div>
                                <div class="noteContent">

                                </div>
                        </a4j:repeat>
                    </div>
                </div>

                <rich:modalPanel id="ajaxLoadingModalBox" minHeight="30" minWidth="40"
                                 height="30" width="40" zindex="2000">
                    <h:outputText value="#{locale.please_wait}" styleClass="startDummer"></h:outputText>
                </rich:modalPanel>


                <div class="fotter-page">
                    <jsp:include page="../../common/pagingEmployee.jsp"/>
                </div>
            </div>

        </a4j:form>
    </body>
    <script type="text/javascript" src="../scripts/webcame/jquery.webcam.js"></script>
</html>
